<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>OutlineNode - Three.js Docs</title>
	<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
	<script src="../scripts/highlight.min.js"></script>
	<link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
	<link type="text/css" rel="stylesheet" href="../styles/page.css">
</head>
<body>
		<p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Node.html">Node</a> → <a href="TempNode.html">TempNode</a> → </p>
	<h1 translate="no">OutlineNode</h1>
		<section>
			<header>
				<div class="class-description"><p>Post processing node for rendering outlines around selected objects. The node
gives you great flexibility in composing the final outline look depending on
your requirements.</p></div>
				<h2>Code Example</h2>
				<div translate="no"><pre><code class="language-js">const postProcessing = new THREE.PostProcessing( renderer );
const scenePass = pass( scene, camera );
// outline parameter
const edgeStrength = uniform( 3.0 );
const edgeGlow = uniform( 0.0 );
const edgeThickness = uniform( 1.0 );
const visibleEdgeColor = uniform( new THREE.Color( 0xffffff ) );
const hiddenEdgeColor = uniform( new THREE.Color( 0x4e3636 ) );
outlinePass = outline( scene, camera, {
	selectedObjects,
	edgeGlow,
	edgeThickness
} );
// compose custom outline
const { visibleEdge, hiddenEdge } = outlinePass;
const outlineColor = visibleEdge.mul( visibleEdgeColor ).add( hiddenEdge.mul( hiddenEdgeColor ) ).mul( edgeStrength );
postProcessing.outputNode = outlineColor.add( scenePass );
</code></pre></div>
			</header>
			<article>
				<h2 class="subsection-title">Import</h2>
				<p><span translate="no">OutlineNode</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
				<pre><code class="language-js">import { outline } from 'three/addons/tsl/display/OutlineNode.js';</code></pre>
				<div class="container-overview">
					<h2>Constructor</h2>
					<h3 class="name name-method" id="OutlineNode" translate="no">new <a href="#OutlineNode">OutlineNode</a><span class="signature">( scene : <span class="param-type"><a href="Scene.html">Scene</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span>, params : <span class="param-type">Object</span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>Constructs a new outline node.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>scene</strong>
									</td>
									<td class="description last">
										<p>A reference to the scene.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>camera</strong>
									</td>
									<td class="description last">
										<p>The camera the scene is rendered with.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>params</strong>
									</td>
									<td class="description last">
										<p>The configuration parameters.</p>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>selectedObjects</strong>
									</td>
									<td class="description last">
										<p>An array of selected objects.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>edgeThickness</strong>
									</td>
									<td class="description last">
										<p>The thickness of the edges.</p>
										<p>Default is <code>float(1)</code>.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>edgeGlow</strong>
									</td>
									<td class="description last">
										<p>Can be used for an animated glow/pulse effects.</p>
										<p>Default is <code>float(0)</code>.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>downSampleRatio</strong>
									</td>
									<td class="description last">
										<p>The downsample ratio.</p>
										<p>Default is <code>2</code>.</p>
									</td>
								</tr>
							</tbody>
						</table>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<h2 class="subsection-title">Properties</h2>
				<div class="member">
					<h3 class="name" id="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
					<div class="description">
						<p>The camera the scene is rendered with.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="downSampleRatio" translate="no">.<a href="#downSampleRatio">downSampleRatio</a><span class="type-signature"> : number</span> </h3>
					<div class="description">
						<p>The downsample ratio.</p>
						<p>Default is <code>2</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="edgeGlowNode" translate="no">.<a href="#edgeGlowNode">edgeGlowNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;float></span> </h3>
					<div class="description">
						<p>Can be used for an animated glow/pulse effect.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="edgeThicknessNode" translate="no">.<a href="#edgeThicknessNode">edgeThicknessNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;float></span> </h3>
					<div class="description">
						<p>The thickness of the edges.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="hiddenEdge" translate="no">.<a href="#hiddenEdge">hiddenEdge</a> </h3>
					<div class="description">
						<p>A mask value that represents the hidden edge.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="scene" translate="no">.<a href="#scene">scene</a><span class="type-signature"> : <a href="Scene.html">Scene</a></span> </h3>
					<div class="description">
						<p>A reference to the scene.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="selectedObjects" translate="no">.<a href="#selectedObjects">selectedObjects</a><span class="type-signature"> : Array.&lt;<a href="Object3D.html">Object3D</a>></span> </h3>
					<div class="description">
						<p>An array of selected objects.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="updateBeforeType" translate="no">.<a href="#updateBeforeType">updateBeforeType</a><span class="type-signature"> : string</span> </h3>
					<div class="description">
						<p>The <code>updateBeforeType</code> is set to <code>NodeUpdateType.FRAME</code> since the node renders
its effect once per frame in <code>updateBefore()</code>.</p>
						<p>Default is <code>'frame'</code>.</p>
					</div>
						<dl class="details">
							<dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBeforeType">TempNode#updateBeforeType</a></dt>
						</dl>
				</div>
				<div class="member">
					<h3 class="name" id="visibleEdge" translate="no">.<a href="#visibleEdge">visibleEdge</a> </h3>
					<div class="description">
						<p>A mask value that represents the visible edge.</p>
					</div>
				</div>
				<h2 class="subsection-title">Methods</h2>
					<h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
					<div class="method">
						<div class="description">
							<p>Frees internal resources. This method should be called
when the effect is no longer required.</p>
						</div>
						<dl class="details">
							<dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#dispose">TempNode#dispose</a></dt>
						</dl>
					</div>
					<h3 class="name name-method" id="getTextureNode" translate="no">.<a href="#getTextureNode">getTextureNode</a><span class="signature">()</span><span class="type-signature"> : <a href="PassTextureNode.html">PassTextureNode</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns the result of the effect as a texture node.</p>
						</div>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A texture node that represents the result of the effect.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="setSize" translate="no">.<a href="#setSize">setSize</a><span class="signature">( width : <span class="param-type">number</span>, height : <span class="param-type">number</span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>Sets the size of the effect.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>width</strong>
									</td>
									<td class="description last">
										<p>The width of the effect.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>height</strong>
									</td>
									<td class="description last">
										<p>The height of the effect.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<h3 class="name name-method" id="setup" translate="no">.<a href="#setup">setup</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : <a href="PassTextureNode.html">PassTextureNode</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>This method is used to setup the effect's TSL code.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>builder</strong>
									</td>
									<td class="description last">
										<p>The current node builder.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#setup">TempNode#setup</a></dt>
						</dl>
					</div>
					<h3 class="name name-method" id="updateBefore" translate="no">.<a href="#updateBefore">updateBefore</a><span class="signature">( frame : <span class="param-type"><a href="NodeFrame.html">NodeFrame</a></span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>This method is used to render the effect once per frame.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>frame</strong>
									</td>
									<td class="description last">
										<p>The current node frame.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-overrides"><strong>Overrides:</strong> <a href="TempNode.html#updateBefore">TempNode#updateBefore</a></dt>
						</dl>
					</div>
				<h2 class="subsection-title">Source</h2>
				<p>
					<a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/OutlineNode.js" translate="no" target="_blank" rel="noopener">examples/jsm/tsl/display/OutlineNode.js</a>
				</p>
			</article>
		</section>
<script src="../scripts/linenumber.js"></script>
<script src="../scripts/page.js"></script>
</body>
</html>